package helper.base

import helper.base.ConstraintHelper.CompositeConstraint.Expand.toW1N2Constraint
import helper.base.PrintHelper.StringTo.toPrintln
import helper.base.RegexHelper.StringTo.toKtVar
import helper.scxml.strategy.StrategyHelper.TimedEventHelper.TimedEvent.Companion.toTimedEvent
import org.junit.Test

internal class RegexHelperTest {
    @Test
    fun t1() {
        val toV1N2Constraint = "0.0<=x<90".toW1N2Constraint()
        val rs = toV1N2Constraint.toString()
        println(rs)
        assert(rs == "0.0<=x<90.0")
    }

    @Test
    fun t2() {
        val arrayOf = arrayOf(
            "0<=x<90",
            "90<=x<100",
            "100<=x<=100",
            "0<=x<100",
            "90<=x<=100",
            "0<=x<=100",
            "60<=x<=120",
            "20<=x<=140",
            "0<=x<=0",
        )
        val sb = StringBuilder()
        arrayOf.map {
            val toV1N2Constraint = it.toW1N2Constraint()
            sb.append("${toV1N2Constraint}\n")
        }
        val rs = sb.toString().trim()
        println(rs)
        assert(
            rs == """
                0.0<=x<90.0
                90.0<=x<100.0
                100.0<=x<=100.0
                0.0<=x<100.0
                90.0<=x<=100.0
                0.0<=x<=100.0
                60.0<=x<=120.0
                20.0<=x<=140.0
                0.0<=x<=0.0
            """.trimIndent()
        )
    }

    @Test
    fun t3() {
        println(1.1.toInt())
    }

    @Test
    fun t4() {
        "1,ss".toTimedEvent().toString().toPrintln()
    }

    @Test
    fun t4t2() {
        "        val maxRuns: Int = 0,\n".toKtVar().toPrintln()
    }
}